package com.zhentao.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;


@EnableConfigurationProperties({MinioConfigProperties.class})//将MinioConfigProperties类中的属性映射到MinioConfigProperties对象中
public class MinioConfig {
    @Autowired
    private MinioConfigProperties minioConfigProperties;
    @Bean
    public MinioClient buildMinioClient(){
        return MinioClient.builder().credentials(minioConfigProperties.getAccessKey(), minioConfigProperties.getSecretKey())
                .endpoint(minioConfigProperties.getEndpoint()).build();//创建MinioClient对象
    }
}
